package com.example.christina.repository;

import com.example.christina.enity.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CustomRepository extends JpaRepository<Customer, Integer> {
    Customer findCustomerByusername(String username);

    List<Customer> findByusername(String username);

    // 由于需要以json数据类型列出用户的score，因此使用List<?>
    @Query(value = "select score from Customer c where c.username=?1")
    List<?> findListScore(String username);

    // 这里使用了Integer类型来使用用户的分数
    @Query(value = "select score from Customer c where c.username=?1")
    Integer findIntegerScore(String username);
}
